package org.example.service.impl;

import org.example.mapper.AccountMapper;
import org.example.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    AccountMapper accountMapper;

    @Override
    public void transfer(String from, String to, int money) {
        // 转出金额
        accountMapper.outMoney(from, money);

        //int a = 10/0;// 手动创建一个异常

        // 转入金额
        accountMapper.inMoney(to, money);
    }

}
